<?php

namespace common\models\myhtsq;

use Yii;
use common\models\BaseModel;


/**
 * This is the model class for table "myscrm_revenue".
 *
 * @property string $revenue_id
 * @property string $contract_id
 * @property integer $revenue_type
 * @property string $amount
 * @property string $operation_begin_date
 * @property string $operation_end_date
 * @property string $created_on
 * @property string $created_by
 * @property string $modified_on
 * @property string $modified_by
 */
class ContractRevenueModel extends BaseModel
{
	public $revenue_id;
	public $amount;
	public $revenue_type;
	public $created_on;
	public $modified_on;
	public $created_by;
	public $modified_by;
	public $contract_id;
    public $income_code;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_contract_revenue';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
        	//增加收入信息
            [['amount'], 'number','on'=>'add'],
            [['created_on', 'modified_on','created_by','modified_by'], 'safe','on'=>'add'],
            [['revenue_id', 'contract_id','revenue_type'], 'string', 'max' => 36,'on'=>'add'],
        		
        	//更新收入场景
        	[['revenue_id'], 'required','on'=>'update'],
        	[['amount'], 'number','on'=>'update'],
        	[['created_on', 'modified_on','created_by','modified_by'], 'safe','on'=>'update'],
        	[['revenue_id', 'contract_id','revenue_type'], 'string', 'max' => 36,'on'=>'update'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'revenue_id' => 'Revenue ID',
            'contract_id' => 'Contract ID',
            'revenue_type' => 'Revenue Type',
            'amount' => 'Amount',
            'created_on' => 'Created On',
            'created_by' => 'Created By',
            'modified_on' => 'Modified On',
            'modified_by' => 'Modified By',
        ];
    }
    
}
